import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
import UserLayout from '@/layouts/UserLayout.vue'
import BasicLayout from '@/layouts/BasicLayout.vue'
import EmptyRouteView from '@/layouts/EmptyRouteView.vue'
import HomeLayout from '@/layouts/HomeLayout.vue'
import RouteView from '@/layouts/RouteView.vue'
import defaultSettings from '@/config/defaultSettings';
const userlist = () => import( /* webpackChunkName: "userlist" */ './views/sysManage/userlist.vue');
const menulist = () => import( /* webpackChunkName: "menulist" */ './views/sysManage/menulist.vue');
const minmenulist = () => import( /* webpackChunkName: "menulist" */ './views/sysManage/minmenulist.vue');
const rolelist = () => import( /* webpackChunkName: "rolelist" */ './views/sysManage/rolelist.vue');
const dictlist = () => import( /* webpackChunkName: "dictlist" */ './views/sysManage/dictlist.vue');
const orglist = () => import( /* webpackChunkName: "orglist" */ './views/sysManage/orglist.vue');
export const asycRouterMap2 = [{
	"path": "/",
	"name": "",
	"redirect": "/faultManage/faultlist",
	"hidden": false,
	"meta": {
		"title": "首页",
		"icon": null,
		"url": "/",
		"permissionList": "home",
		"keepAlive": false,
		"name": "",
		"hidden": false
	},
	"children": [{
		"path": "/faultManage/faultlist",
		"name": "faultlist",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "故障管理",
			"icon": "menu-fault",
			"url": "/faultManage/faultlist",
			"permissionList": "faultManage",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/home",
		"name": "home",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "首页",
			"icon": null,
			"url": "/home",
			"permissionList": "home",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage",
		"name": "sysManage",
		"redirect": "/sysManage/orglist",
		"hidden": false,
		"meta": {
			"title": "系统管理",
			"icon": "menu-sys",
			"url": "/sysManage",
			"permissionList": "sys",
			"keepAlive": true,
			"name": "EmptyRouteView",
			"hidden": false
		},
		"children": [{
			"path": "/sysManage/orglist",
			"name": "orglist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "机构管理",
				"icon": "",
				"url": "/sysManage/orglist",
				"permissionList": "sys:org:list",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "/sysManage/menulist",
			"name": "menulist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "菜单设置",
				"icon": null,
				"url": "/sysManage/menulist",
				"permissionList": "sys:menu",
				"keepAlive": false,
				"name": "EmptyRouteView",
				"hidden": false
			},
			"children": [{
				"path": "/sysManage/menulist/Admin",
				"name": "menulist",
				"redirect": null,
				"hidden": false,
				"meta": {
					"title": "平台菜单",
					"icon": null,
					"url": "/sysManage/menulist/Admin",
					"permissionList": "sys:menu:list",
					"keepAlive": false,
					"name": "",
					"hidden": false
				},
				"children": [],
				"hideChildrenInMenu": true
			}, {
				"path": "/sysManage/menulist/App",
				"name": "minmenulist",
				"redirect": null,
				"hidden": false,
				"meta": {
					"title": "移动端菜单",
					"icon": null,
					"url": "/sysManage/menulist/App",
					"permissionList": "sys:menuWc:list",
					"keepAlive": false,
					"name": "",
					"hidden": false
				},
				"children": [],
				"hideChildrenInMenu": true
			}],
			"hideChildrenInMenu": false
		}, {
			"path": "sysManage/deptlist",
			"name": "deptlist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "部门设置",
				"icon": null,
				"url": "sysManage/deptlist",
				"permissionList": "sys:dept:list",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "sysManage/role",
			"name": "role",
			"redirect": "sysManage/rolelist",
			"hidden": false,
			"meta": {
				"title": "角色管理",
				"icon": null,
				"url": "sysManage/role",
				"permissionList": "sys:role",
				"keepAlive": false,
				"name": "EmptyRouteView",
				"hidden": false
			},
			"children": [{
				"path": "sysManage/rolelist",
				"name": "rolelist",
				"redirect": null,
				"hidden": true,
				"meta": {
					"title": "角色管理",
					"icon": null,
					"url": "sysManage/rolelist",
					"permissionList": "sys:role:list",
					"keepAlive": false,
					"name": "",
					"hidden": true
				},
				"children": [],
				"hideChildrenInMenu": true
			}, {
				"path": "/sysManage/userByrole",
				"name": "roleUserlist",
				"redirect": null,
				"hidden": true,
				"meta": {
					"title": "角色设置",
					"icon": null,
					"url": "/sysManage/userByrole",
					"permissionList": "sys:role:bind",
					"keepAlive": false,
					"name": "",
					"hidden": true
				},
				"children": [],
				"hideChildrenInMenu": true
			}],
			"hideChildrenInMenu": true
		}, {
			"path": "/sysManage/user",
			"name": "userlist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "账户管理",
				"icon": null,
				"url": "/sysManage/user",
				"permissionList": "sys:user:list",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "sysManage/dictlist",
			"name": "dictlist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "资源字典",
				"icon": null,
				"url": "sysManage/dictlist",
				"permissionList": "sys:dict:list",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}],
		"hideChildrenInMenu": false
	}, {
		"path": "/deviceManage/devicelist1",
		"name": "devicelist2",
		"redirect": "",
		"hidden": true,
		"meta": {
			"title": "控制器管理old",
			"icon": "menu-device",
			"url": "/deviceManage/devicelist1",
			"permissionList": "devieManage2",
			"keepAlive": false,
			"name": "",
			"hidden": true
		},
		"children": [],
		"hideChildrenInMenu": true
	}, {
		"path": "/FisheriesManagement/Fisheries",
		"name": "FisheriesView",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "渔场管理",
			"icon": "menu-fishfarm",
			"url": "/FisheriesManagement/Fisheries",
			"permissionList": "fisheries",
			"keepAlive": false,
			"name": "",
			"hidden": false
		},
		"children": [],
		"hideChildrenInMenu": true
	}, {
		"path": "/FishpondManagement/fishpond",
		"name": "fishpond",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "鱼塘管理",
			"icon": "menu-fishpond",
			"url": "/FishpondManagement/fishpond",
			"permissionList": "fishpond",
			"keepAlive": false,
			"name": "",
			"hidden": false
		},
		"children": [{
			"path": "/FishpondManagement/pondDevice/pondDevice",
			"name": "pondDevice",
			"redirect": null,
			"hidden": true,
			"meta": {
				"title": "鱼塘设备",
				"icon": null,
				"url": "/FishpondManagement/pondDevice/pondDevice",
				"permissionList": "pond:device",
				"keepAlive": false,
				"name": "",
				"hidden": true
			},
			"children": [],
			"hideChildrenInMenu": true
		}],
		"hideChildrenInMenu": true
	}, {
		"path": "/Device",
		"name": "Device",
		"redirect": "/Device/Stock/StockManage",
		"hidden": false,
		"meta": {
			"title": "设备管理",
			"icon": "menu-device",
			"url": "/Device",
			"permissionList": "Device",
			"keepAlive": false,
			"name": "EmptyRouteView",
			"hidden": false
		},
		"children": [{
			"path": "/Device/Stock/StockManage",
			"name": "StockManage",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "库存管理",
				"icon": null,
				"url": "/Device/Stock/StockManage",
				"permissionList": "StockManage",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "/deviceManage/devicelist",
			"name": "devicelist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "控制器设备",
				"icon": "",
				"url": "/deviceManage/devicelist",
				"permissionList": "devieManage:devicelist",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "/deviceManage/monitordevlist",
			"name": "monitordevlist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "水质监测设备",
				"icon": null,
				"url": "/deviceManage/monitordevlist",
				"permissionList": "deviceManage:monitordevlist",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "/Device/Equipmentrenewal",
			"name": "Equipmentrenewal",
			"redirect": "/Device/Equipmentrenewal/Prepaidorders",
			"hidden": false,
			"meta": {
				"title": "设备续费记录",
				"icon": null,
				"url": "/Device/Equipmentrenewal",
				"permissionList": "Equipmentpay",
				"keepAlive": false,
				"name": "EmptyRouteView",
				"hidden": false
			},
			"children": [{
				"path": "/Device/Equipmentrenewal/Prepaidorders",
				"name": "Prepaidorders",
				"redirect": null,
				"hidden": false,
				"meta": {
					"title": "续费订单",
					"icon": null,
					"url": "/Device/Equipmentrenewal/Prepaidorders",
					"permissionList": "Equipmentpay:Prepaidorders",
					"keepAlive": false,
					"name": "",
					"hidden": false
				},
				"children": [],
				"hideChildrenInMenu": true
			}, {
				"path": "/Device/Equipmentrenewal/refundOrder",
				"name": "refundOrder",
				"redirect": null,
				"hidden": false,
				"meta": {
					"title": "退款订单",
					"icon": null,
					"url": "/Device/Equipmentrenewal/refundOrder",
					"permissionList": "Equipmentpay:refundOrder",
					"keepAlive": false,
					"name": "",
					"hidden": false
				},
				"children": [],
				"hideChildrenInMenu": true
			}],
			"hideChildrenInMenu": false
		}],
		"hideChildrenInMenu": false
	}],
	"hideChildrenInMenu": false
}, {
	"path": "/studentManage",
	"name": "studentManage",
	"redirect": "/studentManage/studentlist",
	"hidden": false,
	"meta": {
		"title": "学生管理",
		"icon": null,
		"url": "/studentManage",
		"permissionList": "student",
		"keepAlive": false,
		"name": "",
		"hidden": false
	},
	"children": [{
		"path": "/studentManage/studentlist",
		"name": "studentManage",
		"redirect": null,
		"hidden": true,
		"meta": {
			"title": "学生管理",
			"icon": null,
			"url": "/studentManage/studentlist",
			"permissionList": "student:list",
			"keepAlive": false,
			"name": "",
			"hidden": true
		}
	}, {
		"path": "/studentManage/bindDevice",
		"name": "bindDevice",
		"redirect": null,
		"hidden": true,
		"meta": {
			"title": "设备绑定",
			"icon": null,
			"url": "/studentManage/bindDevice",
			"permissionList": "bindDevice",
			"keepAlive": false,
			"name": "",
			"hidden": true
		}
	}],
	"hideChildrenInMenu": true
}, {
	"path": "/answerManage",
	"name": "answerManage",
	"redirect": "/answerManage/examqslist",
	"hidden": false,
	"meta": {
		"title": "答题管理",
		"icon": null,
		"url": "/answerManage",
		"permissionList": "answer",
		"keepAlive": false,
		"name": "",
		"hidden": false
	},
	"children": [{
		"path": "/answerManage/examqslist",
		"name": "examqslist",
		"redirect": null,
		"hidden": true,
		"meta": {
			"title": "答题管理",
			"icon": null,
			"url": "/answerManage/examqslist",
			"permissionList": "examqs",
			"keepAlive": false,
			"name": "",
			"hidden": true
		},
		"children": [],
		"hideChildrenInMenu": true
	}, {
		"path": "/answerManage/addTestExam",
		"name": "addTestExam",
		"redirect": null,
		"hidden": true,
		"meta": {
			"title": "新增试卷",
			"icon": null,
			"url": "/answerManage/addTestExam",
			"permissionList": "examqs:addTestExam",
			"keepAlive": false,
			"name": "",
			"hidden": true
		}
	}, {
		"path": "/answerManage/analysis",
		"name": "analysis",
		"redirect": "/analysis/gradereport",
		"hidden": true,
		"meta": {
			"title": "分析报告",
			"icon": null,
			"url": "/answerManage/analysis",
			"permissionList": "analysis",
			"keepAlive": false,
			"name": "EmptyRouteView",
			"hidden": true
		},
		"children": [{
			"path": "/analysis/gradereport",
			"name": "gradereport",
			"redirect": null,
			"hidden": true,
			"meta": {
				"title": "年级报告",
				"icon": null,
				"url": "/analysis/gradereport",
				"permissionList": "analysis:gradereport",
				"keepAlive": false,
				"name": "",
				"hidden": true
			}
		}, {
			"path": "/analysis/classreport",
			"name": "classreport",
			"redirect": null,
			"hidden": true,
			"meta": {
				"title": "班级报告",
				"icon": null,
				"url": "/analysis/classreport",
				"permissionList": "analysis:classreport",
				"keepAlive": false,
				"name": "",
				"hidden": true
			}
		}],
		"hideChildrenInMenu": true
	}, {
		"path": "/analysis/gradereport",
		"name": "gradereport",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "年级报告",
			"icon": null,
			"url": "/analysis/gradereport",
			"permissionList": "analysis:gradereport",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/analysis/classreport",
		"name": "classreport",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "班级报告",
			"icon": null,
			"url": "/analysis/classreport",
			"permissionList": "analysis:classreport",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}],
	"hideChildrenInMenu": false
}, {
	"path": "/sysManages",
	"name": "sysManages",
	"redirect": "/sysManage/school",
	"hidden": false,
	"meta": {
		"title": "系统管理",
		"icon": null,
		"url": "/sysManages",
		"permissionList": "sys",
		"keepAlive": false,
		"name": "",
		"hidden": false
	},
	"children": [{
		"path": "/sysManage/school",
		"name": "school",
		"redirect": "",
		"hidden": false,
		"meta": {
			"title": "学校管理",
			"icon": null,
			"url": "/sysManage/school",
			"permissionList": "school",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/campuslist",
		"name": "campuslist",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "校区管理",
			"icon": null,
			"url": "/sysManage/campuslist",
			"permissionList": "campus",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/baseInfo",
		"name": "baseInfo",
		"redirect": "/sysManage/grade",
		"hidden": false,
		"meta": {
			"title": "基础信息",
			"icon": null,
			"url": "/sysManage/baseInfo",
			"permissionList": "base",
			"keepAlive": false,
			"name": "EmptyRouteView",
			"hidden": false
		},
		"children": [{
			"path": "/sysManage/grade",
			"name": "gradelist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "年级信息",
				"icon": null,
				"url": "/sysManage/grade",
				"permissionList": "base:grade",
				"keepAlive": false,
				"name": "",
				"hidden": false
			}
		}, {
			"path": "/sysManage/classlist",
			"name": "classlist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "班级信息",
				"icon": null,
				"url": "/sysManage/classlist",
				"permissionList": "base:class",
				"keepAlive": false,
				"name": "",
				"hidden": false
			},
			"children": [],
			"hideChildrenInMenu": true
		}, {
			"path": "/sysManage/subjectlist",
			"name": "subjectlist",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "科目信息",
				"icon": null,
				"url": "/sysManage/subjectlist",
				"permissionList": "base:subject",
				"keepAlive": false,
				"name": "",
				"hidden": false
			}
		}],
		"hideChildrenInMenu": false
	}, {
		"path": "/sysManage/teacherlist",
		"name": "teacherlist",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "教师信息",
			"icon": null,
			"url": "/sysManage/teacherlist",
			"permissionList": "teacher",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/parentslist",
		"name": "parentslist",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "家长信息",
			"icon": null,
			"url": "/sysManage/parentslist",
			"permissionList": "parentslist",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/accountlist",
		"name": "accountlist",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "账户管理",
			"icon": null,
			"url": "/sysManage/accountlist",
			"permissionList": "account",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/rolelists",
		"name": "rolelists",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "权限设置",
			"icon": null,
			"url": "/sysManage/rolelists",
			"permissionList": "role",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/dictlists",
		"name": "dictlists",
		"redirect": null,
		"hidden": false,
		"meta": {
			"title": "数据字典",
			"icon": null,
			"url": "/sysManage/dictlists",
			"permissionList": "dict",
			"keepAlive": false,
			"name": "",
			"hidden": false
		}
	}, {
		"path": "/sysManage/menuset",
		"name": "menuset",
		"redirect": "/sysManage/menulists",
		"hidden": false,
		"meta": {
			"title": "菜单设置",
			"icon": null,
			"url": "/sysManage/menuset",
			"permissionList": "menuset",
			"keepAlive": false,
			"name": "EmptyRouteView",
			"hidden": false
		},
		"children": [{
			"path": "/sysManage/menulists",
			"name": "menulists",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "平台菜单",
				"icon": null,
				"url": "/sysManage/menulists",
				"permissionList": "menu",
				"keepAlive": false,
				"name": "",
				"hidden": false
			}
		}, {
			"path": "/sysManage/minmenulists",
			"name": "minmenulists",
			"redirect": null,
			"hidden": false,
			"meta": {
				"title": "移动端菜单",
				"icon": null,
				"url": "/sysManage/minmenulists",
				"permissionList": "minmenu",
				"keepAlive": false,
				"name": "",
				"hidden": false
			}
		}],
		"hideChildrenInMenu": false
	}],
	"hideChildrenInMenu": false
}];
export const asycRouterMap = [{
	path: '/',
	hidden: true,
	redirect: '/home',
	component: HomeLayout,
	children: [{
		name: 'home',
		path: '/home',
		component: () => import('@/views/home/home.vue'),
		meta: {
			title: '首页',
		}
	}],
}]
export const constantRouterMap = [{
		path: '/redirect',
		component: BasicLayout,
		hidden: true,
		children: [{
			name: 'redirect',
			path: '/redirect/:path(.*)',
			component: () => import('@/components/redirect.vue')
		}]
	},
	{
		name: 'perinfo',
		path: '/perinfo',
		hidden: true,
		component: () => import('@/views/user/userinfo.vue'),
		meta: {
			title: '个人信息',
		}
	},
	{
		path: '/usercenter',
		component: BasicLayout,
		hidden: true,
		redirect: '/userinfo',
		children: [{
			name: 'userinfo',
			path: '/userinfo',
			component: () => import('@/views/user/userinfo.vue'),
			meta: {
				title: '个人信息',
			}
		}]
	},

	{
		path: '/user',
		component: UserLayout,
		redirect: '/login',
		hidden: true,
		children: [{
				path: 'login',
				name: 'login',
				component: () => import( /* webpackChunkName: "user" */ '@/views/user/Login')
			}

		]
	},

	{
		path: '/404',
		hidden: true,
		component: () =>
			import('@/components/404/index.vue')
	}

]

const router = new Router({
	// mode: 'history',
	base: '/',
	//routes: [...constantRouterMap],
	routes: asycRouterMap.concat([...constantRouterMap]),
	scrollBehavior(to, from, savedPosition) {
		return {
			x: 0,
			y: 0
		}
	}

})

router.afterEach((to, from) => {
	document.title = defaultSettings.title;
})

const originalPush = Router.prototype.push
/* 处理重复点击的问题 */
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
export default router